$(function () {
    load();
})

function fh() {
    localStorage.removeItem("mManufactureXQCha");
    location.href = "../../wen_zhi_yi/mManufactureCha.html";
}

function load() {
    let mManufacture = JSON.parse(localStorage.getItem("mManufactureXQCha"));
    $("#register").text(mManufacture.register);
    $("#registerTime").text(mManufacture.registertime);
    $("#checker").text(mManufacture.checker);
    $("#checkTime").text(mManufacture.checktime);

    $("#manufactureId").text(mManufacture.manufactureid);
    $("#productId").text(mManufacture.productid);
    $("#productName").text(mManufacture.productname);
    $("#amount").text(mManufacture.amount);
    $("#designer").text(mManufacture.designer);
    $("#gongshi").text(mManufacture.labourcostpricesum);
    $("#wuliao").text(mManufacture.modulecostpricesum);
    $("#realModuleCostPriceSum").text(mManufacture.realmodulecostpricesum==null?'0.00':mManufacture.realmodulecostpricesum);
    $("#realLabourCostPriceSum").text(mManufacture.reallabourcostpricesum==null?'0.00':mManufacture.reallabourcostpricesum);
    $("#productDescribe").text(mManufacture.productdescribe);
    $("#remark").text(mManufacture.remark);

    $.post("/Mmanufacture.do/mManufactureWZYSHlist", {id: mManufacture.id}, function (sdata) {
        let str = " <tr>\n" +
            "          <th>序号</th>\n" +
            "          <th>工序状态</th>+\n" +
            "          <th>工序名称</th>\n" +
            "          <th>设计工时成本(元)</th>\n" +
            "          <th>实际工时成本</th>\n" +
            "          <th>设计物料成本(元)</th>\n" +
            "          <th>实际物料成本</th>\n" +
            "      </tr>\n";
        $.each(sdata, function (index, item) {
            str += "      <tr>\n" +
                "          <td>" + item.detailsnumber + "</td>\n" +
                "          <td><span style='color: lightsalmon;'>" + (item.procedurefinishtag=='G004-0'?'等待':'完成') + "</span></td>\n" +
                "          <td>" + item.procedurename + "</td>\n" +

                "          <td>" + item.subtotal + "</td>\n" +
                "          <td><span style='color:#38bef3;'>" + (item.realsubtotal==null?'0.00':item.realsubtotal) + "</span> </td>\n" +
                "          <td>" + item.modulesubtotal + "</td>\n" +
                "          <td><span style='color:#38bef3;'>" + (item.realmodulesubtotal==null?'0.00':item.realmodulesubtotal) + "</span> </td>\n" +
                "      </tr>";
        })
        $("#tableCha").html(str);
    })
}

